#ifndef _P7ZIP_HELPER_H_
#define _P7ZIP_HELPER_H_
#include <cf_common.h>
#include <cf_string.h>

typedef enum{ARCH_7Z, ARCH_TAR_GZ, ARCH_TAR_BZ2, ARCH_ZIP} ArchType;
#define P7Z_CLI "/usr/bin/7z"
#define P7Z_GUI "/usr/bin/7zG"
#define P7Z_ACTION_ADD  ("a")
#define P7Z_ACTION_EXTRACT_WITH_PATH  ("x")
#define P7Z_TYPE_7Z ("-t7z")
#define P7Z_TYPE_ZIP    ("-tzip")
#define P7Z_TYPE_TAR    ("-ttar")
#define P7Z_TYPE_GZIP    ("-tgzip")
#define P7Z_TYPE_BZIP2    ("-tbzip2")

typedef struct p7zip{
    const char* bin;
    const char* action;
    const char* typePara;
    int cl;
    CFString* clPara;
    
    int mt;
    CFString* mtPara;
    
    const char* passwd;
    CFString* passwdPara;
    
    long long volSize;
    CFString* volSizePara;
    
    const char** files;
    int fileCount;
    
    BOOL si;
    
    BOOL so;
    
    const char* archive;
    CFString* archivePara;
    
    const char* outDir;
    CFString* outDirPara;
    
    const char** pParams;
    int pIdx;
}P7zip;
int P7zipInit(P7zip* this);
int P7zipExit(P7zip* this);
int Compress7z(int fileCount, const char* files[], const char* archive, int cl, int mt, long long vol, const char* passwd);
int CompressZip(int fileCount, const char* files[], const char* archive, int cl, int mt, long long vol, const char* passwd);
int CompressTarGzip(int fileCount, const char* files[], const char* archive, int cl, int mt, long long vol);
int CompressTarBzip2(int fileCount, const char* files[], const char* archive, int cl, int mt, long long vol);
int Extract(const char* file, const char* dest);
int ExtractTarXX(const char* file, const char* dest);
#endif
